import Mock from 'mockjs'
import { topCategory } from '@/api/constants.js'
const Random = Mock.Random

export const getTopCategory = () => {
  const result = []

  topCategory.forEach(item => {
    const children = []

    for (let i = 0; i < Random.integer(0, 10); i++) {
      children.push({
        id: Random.id(),
        name: Random.ctitle(2),
        picture: Random.image()
      })
    }

    result.push({
      children,
      id: Random.id(),
      name: item,
      picture: Random.image()
    })
  })

  return { message: '操作成功', result }
}
